package com.example.kaoshi.controller;

import com.example.kaoshi.entity.User;
import com.example.kaoshi.mapper.UserMapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    UserMapper userMapper;
    @PostMapping("/login")
    public User login(@RequestBody User user){
      User dbUser = userMapper.getUserByNameAndPassword(user.getUsername(),user.getPassword());
        return dbUser;
    }
}
